cmake_minimum_required(VERSION 3.0.2)
project(storm_car)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  std_msgs
  message_generation
  serial
  tf
  pcl_ros
  pcl_msgs
)

add_compile_options(-std=c++11)

add_message_files(
  FILES
  can_data.msg
  car_status.msg
)

generate_messages(
  DEPENDENCIES
  std_msgs
)

catkin_package(
  CATKIN_DEPENDS
  roscpp
  std_msgs
  message_runtime
)

include_directories(
  include
  include/hardware/can
  include/hardware/serial
  include/map
  include/screen
  include/obstacle
  ${catkin_INCLUDE_DIRS}
)

link_directories(
  ${catkin_LIB_DIRS}
  lib/
)

add_executable( CAN_EMUC
                src/hardware/can/can_emuc.cpp)
target_link_libraries(CAN_EMUC ${catkin_LIBRARIES} Emuc64.a)
add_dependencies(CAN_EMUC storm_car_generate_messages_cpp)

add_executable( CAN_LC
                src/hardware/can/can_lc.cpp)
target_link_libraries(CAN_LC ${catkin_LIBRARIES} CanCmd.so)
add_dependencies(CAN_LC storm_car_generate_messages_cpp)

add_executable( SERIAL
                src/hardware/serial/serial.cpp
                src/hardware/serial/serial_driver.cpp)
target_link_libraries(SERIAL ${catkin_LIBRARIES})
add_dependencies(SERIAL storm_car_generate_messages_cpp)

add_executable( SERIAL_SIM
                src/hardware/serial/serial_sim.cpp
                src/hardware/serial/serial_driver.cpp)
target_link_libraries(SERIAL_SIM ${catkin_LIBRARIES})
add_dependencies(SERIAL_SIM storm_car_generate_messages_cpp)

add_executable( RECORD
                src/map/record.cpp
                src/hardware/serial/serial_driver.cpp)
target_link_libraries(RECORD ${catkin_LIBRARIES})
add_dependencies(RECORD storm_car_generate_messages_cpp)

add_executable( MAP
                src/map/map.cpp
                src/map/map_driver.cpp
                src/hardware/serial/serial_driver.cpp
                src/screen/screen_driver.cpp)
target_link_libraries(MAP ${catkin_LIBRARIES})
add_dependencies(MAP storm_car_generate_messages_cpp)


add_executable( SCREEN
                src/screen/screen.cpp
                src/screen/screen_driver.cpp)
target_link_libraries(SCREEN ${catkin_LIBRARIES})
add_dependencies(SCREEN storm_car_generate_messages_cpp)

add_executable( TF
                src/map/tf.cpp
                src/map/map_driver.cpp
                src/hardware/serial/serial_driver.cpp)
target_link_libraries(TF ${catkin_LIBRARIES})
add_dependencies(TF storm_car_generate_messages_cpp)

add_executable( OBSTACLE
                src/obstacle/obstacle.cpp
                src/obstacle/euler_kmeans++.cpp
                src/screen/screen_driver.cpp)
target_link_libraries(OBSTACLE ${catkin_LIBRARIES})
add_dependencies(OBSTACLE storm_car_generate_messages_cpp)